package com.elite.groovy.dev;

import com.elite.groovy.kh.KHExcelUtil;
import com.elite.groovy.kh.KHUtil;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

/**
 * @projectName: ngsapitask-davco
 * @package: com.elite.groovy.kh
 * @className: KHExcelDev
 * @description: TODO
 * @author: LiJT
 * @date: 2023-11-24 15:49
 * @version: 1.0
 */
public class KHExcelDev {
    public static void main(String[] args) {
        // 表头
        List<String> headList = new ArrayList<>();
        headList.add("姓名");
        headList.add("年龄班级班级班级");
        headList.add("班级班级班级班级班级班级班级班级班级班级班级");

        // 数据列
        List<LinkedHashMap<String, Object>> dataList = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            LinkedHashMap<String, Object> map = new LinkedHashMap<>();
            map.put("name", i);
            map.put("age", i);
            map.put("class", i + "aaaaaaaaaaaaaaaaaaa班级班级班级班级班级班级班级班级班级班级班级");
            dataList.add(map);
        }

        try {
            String path2 = KHExcelUtil.getInstance().exportExcel(dataList, headList, "E:\\", "excel2007导出-"+ KHUtil.getIntRandom(6));
            System.out.println(path2);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
